<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>个人中心</title>
    <link rel="stylesheet" type="text/css" th:href="@{../static/css/homepage.css}" />
</head>
<body>
<button id="back"><a th:href="@{/toIndex}">返回</a></button>
<div id="mainText">
    <h1>个人中心</h1>
    <ul th:each="u:${userinfo}">
        <li><span class="remark">昵称&nbsp;&nbsp;:&nbsp;&nbsp;</span>
            <form action="/update/name" method="post" style="display: inline"><input type="text" th:value="${u.getName()}" name="name"/><button class="modify" id="mname">修改</button></form>
        </li><br/>
        <li><span class="remark">用户名&nbsp;&nbsp;:&nbsp;&nbsp;</span>
            <input type="text" th:value="${u.getUsername()}" readonly/>
        </li><br/>
        <li><span class="remark">密码&nbsp;&nbsp;:&nbsp;&nbsp;</span>
            <form action="/update/password" method="post" style="display: inline"><input type="password" th:value="${u.getPassword()}" name="password"/><button class="modify" id="mpwd">修改</button></form>
        </li><br/>
        <li><span class="remark">权限&nbsp;&nbsp;:&nbsp;&nbsp;</span>
            <input type="text" th:value="${authority}" readonly/>
        </li><br/>
        <li><span class="remark">备注&nbsp;&nbsp;:&nbsp;&nbsp;</span>
            <form action="/update/remarks" method="post" style="display: inline"><input type="text" th:value="${u.getRemarks()}" name="remarks"/><button class="modify" id="mrm">修改</button></form>
        </li><br/>
    </ul>
    <form action="/login/toLogin" method="post" style="display: inline"><button id="cgacct">更换账户</button></form>
    <form action="/login/logout" method="post" style="display: inline"><button id="exit">退出登录</button></form>
</div>

<script th:inline="javascript">
    window.onload = function() {
        var name = [[${session.name}]];
        console.log(name)
        if (name!=null && name!=""){
            document.getElementById("logState").innerText = name;
        }

        if([[${i}]]!==null){
            if ([[${i}]]!=0){
                alert("修改成功！");
            }else {
                alert("修改失败！");
            }
        }
    }
</script>
</body>
</html>